﻿////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// <copyright>Copyright 2008-2011 Andreas Huber Doenni</copyright>
// Distributed under the GNU General Public License version 2 (GPLv2).
// See accompanying file License.txt or copy at http://phuse.codeplex.com/license.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

namespace Phuse.Net.Forums
{
    using Phuse.Net.Nntp;

    /// <summary>Represents a connection to an NNTP host.</summary>
    /// <threadsafety static="true" instance="false"/>
    public sealed class NntpConnection : Connection
    {
        private readonly Client client;

        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        internal NntpConnection(IHostInfo host, Client client) : base(host)
        {
            this.client = client;
        }

        internal Client Client
        {
            get { return this.client; }
        }

        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>See <see cref="Connection.Dispose(bool)"/>.</summary>
        protected sealed override void Dispose(bool disposing)
        {
            try
            {
                if (disposing)
                {
                    this.client.Dispose();
                }
            }
            finally
            {
                base.Dispose(disposing);
            }
        }
    }
}
